//
//  hebdoPlanningView.m
//  testPlanning
//
//  Created by richard_local on 03/09/13.
//  Copyright (c) 2013 ierdre.com. All rights reserved.
//

#import "hebdoPlanningView.h"

@interface hebdoPlanningView ()

@end

@implementation hebdoPlanningView

- (id)initWithStyle:(UITableViewStyle)style
{
    self = [super initWithStyle:style];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    /*self.tableView.layer.masksToBounds=YES;
    self.tableView.layer.borderWidth = 1.0f;
    self.tableView.layer.borderColor = [UIColor redColor].CGColor;*/
    // Uncomment the following line to preserve selection between presentations.
    // self.clearsSelectionOnViewWillAppear = NO;
 
    // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
    // self.navigationItem.rightBarButtonItem = self.editButtonItem;
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    self.tableView.separatorColor = [UIColor clearColor];
    
    /*UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(60,12,10,20)];
    
    [label setText:@"TOTO"];
    [self.parentViewController.view  addSubview:label];*/
    
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 30;
}*/

-(CGFloat)tableView:(UITableView*)tableView heightForHeaderInSection:(NSInteger)section
{
    
    return 1.0;
}


-(CGFloat)tableView:(UITableView*)tableView heightForFooterInSection:(NSInteger)section
{
    return 1.0;
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
#warning Potentially incomplete method implementation.
    // Return the number of sections.
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
#warning Incomplete method implementation.
    // Return the number of rows in the section.
    return 50;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{   NSString *CellIdentifier =@"";
    if (indexPath.row==0){
     CellIdentifier = @"info";

    }
    else if (indexPath.row==1)CellIdentifier = @"entete";
    else CellIdentifier = @"heure";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];

    // Configure the cell...
    //[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
    [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
    //recopier les trames du haut
    /* UITableViewCell *cellEntete = [tableView dequeueReusableCellWithIdentifier:@"info" forIndexPath:indexPath];
    [self.tableView addSubview:cellEntete.viewForBaselineLayout];
    */
    return cell;
}
#pragma mark - Table view delegate

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSLog (@" select ");
    // A case was selected, so push into the CaseDetailViewController
    UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
    if (![cell selectionStyle] == UITableViewCellSelectionStyleNone) {
        // Handle tap code here
    }
}
/*
// Override to support conditional editing of the table view.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
    // Return NO if you do not want the specified item to be editable.
    return YES;
}
*/

/*
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (editingStyle == UITableViewCellEditingStyleDelete) {
        // Delete the row from the data source
        [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
    }   
    else if (editingStyle == UITableViewCellEditingStyleInsert) {
        // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
    }   
}
*/


- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    UIView *myHeader = [[UIView alloc] initWithFrame:CGRectMake(0,0,320,60)] ;
    //myHeader.backgroundColor = [UIColor redColor];
    //UILabel *myLabel = [[UILabel alloc] initWithFrame:CGRectMake(0,0,320,60)] ;
    //myLabel.text = @"Testing header view";
    
    
    //Attention pour la hauteur des deux premiers ligne
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"entete" forIndexPath:nil];
    cell.frame = CGRectMake(0,44,320,44) ;
     UITableViewCell *cell2 = [tableView dequeueReusableCellWithIdentifier:@"info" forIndexPath:nil];
    cell2.frame = CGRectMake(0,0,320,44) ;
   [myHeader addSubview:cell2];
    [myHeader addSubview:cell];
   
    return myHeader;
    
}
// Override to support rearranging the table view.
/*- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath
{
    NSLog(@ " MOVE");
    //UITableViewCell *cellEntete = [tableView dequeueReusableCellWithIdentifier:@"info" forIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]];
                                   
    //[self.tableView addSubview:cellEntete.viewForBaselineLayout];
}
*/

/*
// Override to support conditional rearranging of the table view.
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath
{
    // Return NO if you do not want the item to be re-orderable.
    return YES;
}
*/
//TOUCH

@end
